# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sinfp
_pkgname=Net-SinFP3
pkgver=1.24
pkgrel=9
pkgdesc='A full operating system stack fingerprinting suite.'
arch=('x86_64' 'aarch64')
url='https://cpan.metacpan.org/authors/id/G/GO/GOMOR/'
groups=('blackarch' 'blackarch-fingerprint')
license=('PerlArtistic')
depends=('perl' 'perl-class-gomor' 'perl-data-dumper' 'perl-dbd-sqlite'
        'perl-dbi' 'perl-digest-perl-md5' 'perl-net-frame' 'perl-net-libdnet6'
        'perl-net-frame-device' 'perl-net-libdnet' 'perl-net-netmask'
        'perl-net-write' 'perl-parallel-forkmanager' 'perl-net-ipv4addr'
        'perl-net-frame-dump' 'perl-net-frame-layer-ipv6'
        'perl-net-frame-layer-icmp6' 'perl-net-frame-simple'
        'perl-net-frame-layer-sinfp3' 'perl-io-socket-inet6'
        'perl-time-interval' 'perl-net-write-fast')
source=("http://search.cpan.org/CPAN/authors/id/G/GO/GOMOR/$_pkgname-$pkgver.tar.gz")
sha512sums=('223936980612a19d8b8286ca49a80e6522f43fead23927cf45481cb3455e112666e5d62ce941443c4ba78efe15146fcdb27a813046d9e97b66bdf9cb68a25c0a')

prepare() {
  cd "$_pkgname-$pkgver"

  perl Makefile.PL
}

build() {
  cd "$_pkgname-$pkgver"

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  install -Dm 755 bin/sinfp3.pl "$pkgdir/usr/share/$pkgname/sinfp3.pl"

  ln -sf "/usr/share/$pkgname/sinfp3.pl" "$pkgdir/usr/bin/$pkgname"

  install -Dm 644 "$pkgdir/usr/bin/site_perl/sinfp3.db" \
    "$pkgdir/usr/share/$pkgname/sinfp3.db"

  rm -rf "$pkgdir/usr/bin/site_perl"
}

